package com.moyq5.mvc.maker.test.bean.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.moyq5.mvc.maker.test.bean.embed.TraChannelQrcodeAccountBindId;
import com.moyq5.mvc.maker.test.bean.enums.SysOwnerType;

/**
 * 渠道商户个人收款码账户，即给渠道商户分配支付机构（微信、支付宝等）的个人/企业收款码
 * @author Moyq5
 * @date 2018年9月25日
 */
@Entity
@Table(name = "tra_channel_qrcode_account_bind")
@DynamicUpdate
public class TraChannelQrcodeAccountBind implements java.io.Serializable {

	
	private static final long serialVersionUID = 1L;
	/**
	 * 渠道商户个人收款码账户ID
	 */
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "merchId", column = @Column(name = "merch_id", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "accountId", column = @Column(name = "account_id", nullable = false, precision = 15, scale = 0)) })
	private TraChannelQrcodeAccountBindId id;
	/**
	 * 收款号
	 */	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "account_id", nullable = false, insertable = false, updatable = false)
	private TraChannelQrcodeAccount account;
	/**
	 * 商家
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "merch_id", nullable = false, insertable = false, updatable = false)
	private Merch merch;
	/**
	 * 代理商
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "agent_id", nullable = false)
	private Agent agent;
	/**
	 * 归属类型
	 */
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "owner_type", precision = 2, nullable = false)
	private SysOwnerType ownerType;
	public TraChannelQrcodeAccountBindId getId() {
		return id;
	}
	public void setId(TraChannelQrcodeAccountBindId id) {
		this.id = id;
	}
	public TraChannelQrcodeAccount getAccount() {
		return account;
	}
	public void setAccount(TraChannelQrcodeAccount account) {
		this.account = account;
	}
	public Merch getMerch() {
		return merch;
	}
	public void setMerch(Merch merch) {
		this.merch = merch;
	}
	public Agent getAgent() {
		return agent;
	}
	public void setAgent(Agent agent) {
		this.agent = agent;
	}
	public SysOwnerType getOwnerType() {
		return ownerType;
	}
	public void setOwnerType(SysOwnerType ownerType) {
		this.ownerType = ownerType;
	}
	
}
